package com.c.repository;

import com.c.pojo.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

/**
 * @author bysun
 */

public interface UserRepository extends JpaRepository<User, Integer> {

    /**
     * 通过用户名获取用户
     *
     * @param name
     * @return User
     */
    @Query(value = "SELECT * FROM `user` a WHERE a.userName = ?1", nativeQuery = true)
    User getUserByName(@Param("name") String name);
}
